package com.getword.web.controller;


import com.getword.domain.Advert;
import com.getword.web.model.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/adverts")
public class AdvertsController {
    @GetMapping
    public Result query(){
        List<Advert> adverts = new ArrayList<>();
        adverts.add(new Advert(){{
            setId(1);
            setPicUrl("https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640");
            setAdvertUrl("");
        }});
        adverts.add(new Advert(){{
            setId(1);
            setPicUrl("https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640");
            setAdvertUrl("");
        }});
        adverts.add(new Advert(){{
            setId(1);
            setPicUrl("https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640");
            setAdvertUrl("");
        }});

        return Result.success(adverts);
    }
}
